import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/css/reset.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import * as echarts from 'echarts'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import BaiduMap from 'vue-baidu-map-3x'
import {vue3JsonExcel} from "vue3-json-excel"
import { ElMessage } from 'element-plus';
import { ElIcon } from 'element-plus';
import Vue3CountryIntl from 'vue3-country-intl';
import { ElNotification } from 'element-plus'
//import { createI18n } from 'vue-i18n'
import i18n from "./lang/index.js"
// 引入css
import 'vue3-country-intl/lib/vue3-country-intl.css'
const app = createApp(App)
app.config.globalProperties.$echarts = echarts

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus, {
  locale: zhCn
})
app.use(BaiduMap, {
  ak: 'jr1MRkg2hUhvp7OL8gIOG0SoKRYPNWoH'
})


// 全局注册组件
app.component(Vue3CountryIntl.name, Vue3CountryIntl);

const authRoutes = localStorage.getItem('authRoutes')
if (authRoutes) {
  store.commit('permission/SET_AUTH_ROUTES')
}

app.use(i18n)
app.use(ElNotification);
app.use(ElMessage);
app.use(ElIcon);
app.use(store);
app.use(router);
app.mount('#app')
